<?php

require '../includes/master_include.php';
$user = $_COOKIE['user'];

$artist;
if(array_key_exists('id',$_GET)){

	$albums = library_albums($user,$_GET['id']);
	if($albums){
		$artist = $albums[0]['artist'];
	}
}



?>

<?php if(isset($artist)): ?>
<h2><?php print htmlentities($artist['name']) ?></h2>
<ul>
<?php foreach($albums as $i => $album): ?>
<li>
<div class="item" style="background-image: url(<?php print htmlentities($album['image']['large']) ?>);">
<span><?php print htmlentities($album['name']) ?></span>

<ul class="links">
<?php if(key_exists('spotify_id',$album)): ?>
	<li><a href="spotify:album:<?php print $album['spotify_id'] ?>">Spotify</a></li>
<?php else: ?>
	<li><a href="spotify:search:<?php print str_replace(':',' ',$album['name']) ?>">Search Spotify</a></li>
	<?php endif; ?>
	<li><a href="<?php print $album['url'] ?>">LastFM</a></li>
</ul>


</div>
	</li><?php endforeach; ?>
	</ul>
	<?php endif; ?>

